package com.example.wechat.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.project.core.text.Convert;
import com.example.project.utils.DateUtils;
import com.example.wechat.mapper.WechatGroupMapper;
import com.example.wechat.model.WechatGroup;

/**
 * 微信群聊Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-12
 */
@Service
public class WechatGroupService  {

	@Autowired
	private WechatGroupMapper wechatGroupMapper;

	/**
	 * 查询微信群聊
	 * 
	 * @param id 微信群聊主键
	 * @return 微信群聊
	 */
	
	public WechatGroup selectWechatGroupById(Long id) {
		return wechatGroupMapper.selectWechatGroupById(id);
	}

	/**
	 * 查询微信群聊列表
	 * 
	 * @param wechatGroup 微信群聊
	 * @return 微信群聊
	 */
	
	public List<WechatGroup> selectWechatGroupList(WechatGroup wechatGroup) {
		return wechatGroupMapper.selectWechatGroupList(wechatGroup);
	}

	/**
	 * 新增微信群聊
	 * 
	 * @param wechatGroup 微信群聊
	 * @return 结果
	 */
	
	public int insertWechatGroup(WechatGroup wechatGroup) {
		wechatGroup.setCreateTime(DateUtils.curLocalDateTime());
		return wechatGroupMapper.insertWechatGroup(wechatGroup);
	}

	/**
	 * 修改微信群聊
	 * 
	 * @param wechatGroup 微信群聊
	 * @return 结果
	 */
	
	public int updateWechatGroup(WechatGroup wechatGroup) {
		wechatGroup.setUpdateTime(DateUtils.curLocalDateTime());
		return wechatGroupMapper.updateWechatGroup(wechatGroup);
	}

	/**
	 * 批量删除微信群聊
	 * 
	 * @param ids 需要删除的微信群聊主键
	 * @return 结果
	 */
	
	public int deleteWechatGroupByIds(String ids) {
		return wechatGroupMapper.deleteWechatGroupByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除微信群聊信息
	 * 
	 * @param id 微信群聊主键
	 * @return 结果
	 */
	
	public int deleteWechatGroupById(Long id) {
		return wechatGroupMapper.deleteWechatGroupById(id);
	}
}
